<?php
	// 加载公共文件
	include_once('./public/config/config.php');
	include_once('./public/config/sql.php');

	// 实例化对象
	$obj = new sql($info);

	// 构建SQL语句
	$sql = "select id,`name`,`key`,`describe` from siteInformation";
	$rows = $obj->db_select($sql, false);
?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="keywords" content="<?php echo $rows['key'];?>">
	<meta http-equiv="describe" content="<?php echo $rows['describe'];?>">
	<title><?php echo $rows['name'];?></title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimun-scale=1,maximun-scale=1,user-scalable=no">
	<link rel="stylesheet" type="text/css" href="./public/iconfont/iconfont.css">
	<link rel="stylesheet" type="text/css" href="./public/css/header.css">
	<link rel="stylesheet" type="text/css" href="./public/css/blic.css">
	<link rel="stylesheet" type="text/css" href="./public/css/header_m.css">
	<link rel="stylesheet" type="text/css" href="./public/css/middle.css">
	<link rel="stylesheet" type="text/css" href="./public/css/middle_m.css">
	<link rel="stylesheet" type="text/css" href="./public/css/article_list.css">
	<link rel="stylesheet" type="text/css" href="./public/css/userInterface.css">
	<link rel="stylesheet" type="text/css" href="./public/css/article_details.css">
	<link rel="stylesheet" type="text/css" href="./public/css/aboutUs.css">
	<script src="./public/js/UI.js" type="text/javascript"></script>
	<script src="./public/js/packfunc.js" type="text/javascript"></script>
	<script src="./public/js/middle.js" type="text/javascript"></script>
</head>
<body>
	<header class="myheader">
		<div class="topheader">
			<div class="header_top_c">
				<h2><?php echo $rows['name'];?></h2>

				<!-- 搜索框 -->
				<div id="mysearch">
					<form class="myform" action="./index.php?param=article_list" method="post">
						<input type="text" name="key" placeholder="请输入关键字....">
						<button class="iconfont icon-sousuo"></button>
					</form>
				</div>
			</div>
			<h3 id="menu_btn"><span></span><span></span><span></span></h3>
		</div>

		<!-- 导航 -->
		<div class="header_bottom">
			<nav id="mynav">
				<ul>
					<?php
						// 构建SQL语句
						$sql = "select cid,id,rank,username,link,state from menu order by rank asc";
						$rows = $obj->db_select($sql, true);

						foreach($rows as $val){
							if($val['state'] === '0'){
								$cid = $val['cid'] === '0' ? '' : '&key='.$val['cid'];
								echo '<li><a href="'. $val['link'].$cid .'">'. $val['username'] .'<i class="iconfont icon-sanjiao"></i></a>
									</li>';
							}
						}
					?>			
				</ul>
				<ul class="right">
					<li><a href="javascript:;" onclick="return UI.open({'title':'用户登录','url':'./users_login.php'});">登录</a></li>
					<li><a href="javascript:;" onclick="return UI.open({'title':'用户名注册','url':'./users_logout.php','height':'600'})">注册</a></li>
					<li><a href="./users_login.php">登录</a></li>
					<li><a href="./users_logout.php">注册</a></li>
				</ul>
			</nav>
		</div>
	</header>
	<div id="background_box"></div>
</body>
</html>
<script type="text/javascript">
	// 移动版导航模块的现实与隐藏
	var btn = document.getElementById('menu_btn'),
		body = document.getElementsByTagName('body')[0],
		menu = document.getElementsByClassName('header_bottom')[0];

	var state = false;

	btn.onclick = function(){
		
		menu.style.left = '0px';

		var background = document.createElement('div');
		background.setAttribute('class','background');
		background.style.display = "block";
		body.appendChild(background);
		
		background.onclick = function(){

			menu.style.left = '-282px';
			background.style.display = "none";
		}	
	}
</script>